package com.pulse.base.service.impl;

import com.pulse.base.domain.CircuitMeasureEvent;
import com.pulse.base.mapper.CircuitMeasureEventMapper;
import com.pulse.base.service.ICircuitMeasureEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * 曲线分析结果事件Service业务层处理
 *
 * @author 陆帅
 * @date 2024-07-17
 */
@Service
public class CircuitMeasureEventServiceImpl implements ICircuitMeasureEventService {

    @Autowired
    private CircuitMeasureEventMapper circuitMeasureEventMapper;

    /**
     * 新增
     *
     * @param event
     * @return
     */
    @Override
    public int insertCircuitMeasureEvent(CircuitMeasureEvent event) {
        return circuitMeasureEventMapper.insertCircuitMeasureEvent(event);
    }

    /**
     * 根据曲线id获取事件
     *
     * @param measureId
     * @return
     */
    @Override
    public List<CircuitMeasureEvent> selectCircuitMeasureEventByMeasureId(Long measureId) {
        return circuitMeasureEventMapper.selectCircuitMeasureEventByMeasureId(measureId);
    }

    /**
     * 根据measureId删除
     *
     * @param measureId
     * @return
     */
    @Override
    public int deleteByMeasureId(Long measureId) {
        return circuitMeasureEventMapper.deleteCircuitMeasureEventByMeasureId(measureId);
    }

    /**
     * 根据measureId列表删除
     *
     * @param measureIds
     * @return
     */
    @Override
    public int deleteByMeasureIds(List<Long> measureIds) {
        return circuitMeasureEventMapper.deleteCircuitMeasureEventByMeasureIds(measureIds.toArray(new Long[0]));
    }
}
